#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__
#include "TaskQueue.h"
#include "MyTask.h"
#include <vector>
#include <memory>
#include <thread>

using std::vector;
using std::unique_ptr;
using std::thread;

class WorkThread;
class ThreadPool
{
public:
    ThreadPool(size_t threadNum,size_t queSize);
    ~ThreadPool();
    void start();
    void stop();
    void addTask(ElemType&& ptask);
    ElemType getTask();
    void doTask();

private:
    size_t _threadNum;
    size_t _queSize;
    vector<thread> _threads;
    TaskQueue _taskQue;
    bool _isExit;
};
#endif
